<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %><%--
  Created by IntelliJ IDEA.
  User: WuLiangHang
  Date: 2021/12/20
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    //数组
    request.setAttribute("arr", new String[]{"A", "B", "C", "D", "E"});

    //Map
    Map<String, Object> map = new HashMap<>();
    map.put("key1", "value1");
    map.put("key2", "value2");
    map.put("key3", "value3");
    map.put("key4", "value4");
    map.put("key5", "value5");
    request.setAttribute("map", map);
%>
<%-- 遍历 数组 --%>
<c:forEach items="${arr}" var="item">
    ${item}<br/>
</c:forEach>
<%--遍历 Map--%>
<c:forEach items="${map}" var="entry">
    key = ${entry.key}, value = ${entry.value}<br/>
</c:forEach>
</body>
</html>
